<UserControl x:Class="MiniUML.View.Views.CanvasView"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:views="clr-namespace:MiniUML.View.Views"
              xmlns:utilities="clr-namespace:MiniUML.View.Utilities"
              Background="White"
              AllowDrop="True"
              Focusable="False"
              LayoutUpdated="canvas_LayoutUpdated">

    <ItemsControl x:Name="_itemsControl"
                  Focusable="False"
                  ItemsSource="{Binding Path=_DocumentViewModel.dm_DocumentDataModel.DocumentRoot.Elements}" >

        <ItemsControl.ItemTemplateSelector>
            <utilities:ShapeTemplateSelector/>
        </ItemsControl.ItemTemplateSelector>

        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <Canvas/>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>

        <ItemsControl.ItemContainerStyle>
            <Style TargetType="{x:Type FrameworkElement}">
                <Style.Triggers>
                    <Trigger Property="Selector.IsSelected" Value="true">
                        <Setter Property="BitmapEffect">
                            <Setter.Value>
                                <OuterGlowBitmapEffect GlowColor="#FF60B5FF" GlowSize="4" Opacity="1"/>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </Style.Triggers>
                <Setter Property="Canvas.Left" Value="{Binding Path='Attribute[Left].Value'}"/>
                <Setter Property="Canvas.Top" Value="{Binding Path=Attribute[Top].Value}"/>
            </Style>
        </ItemsControl.ItemContainerStyle>

    </ItemsControl>
    
</UserControl>
